mirror of
https://github.com/codex-team/editor.js
synced 2024-06-02 05:52:38 +02:00
* Issue #426 : Imporve Toolbar position calculating * header tool update * 2.0.5
This commit is contained in:
parent
0ea3197a73
commit
6ac69a48e8
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1 +1 @@
|
|||
Subproject commit 92e5373cf8826492a96b6ca5070552ddf6aa749d
|
||||
Subproject commit da319d4757f1909d049f0f205be62ac08ef377f5
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "codex.editor",
|
||||
"version": "2.0.4",
|
||||
"version": "2.0.5",
|
||||
"description": "Codex Editor. Native JS, based on API and Open Source",
|
||||
"main": "build/codex-editor.js",
|
||||
"scripts": {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import SelectionUtils from '../selection';
|
||||
/**
|
||||
*
|
||||
* «Toolbar» is the node that moves up/down over current block
|
||||
|
@ -176,23 +177,28 @@ export default class Toolbar extends Module {
|
|||
}
|
||||
|
||||
/**
|
||||
* @todo Compute dynamically on prepare
|
||||
* @type {number}
|
||||
* Set Toolbar Min Height as Selection Height (usually similar with Block's height)
|
||||
* Plus Button and Toolbox positioned at the center of the Toolbar
|
||||
*/
|
||||
const defaultToolbarHeight = 49;
|
||||
const defaultOffset = 34;
|
||||
this.nodes.content.style.minHeight = SelectionUtils.rect.height + 'px';
|
||||
|
||||
var newYCoordinate = currentNode.offsetTop - (defaultToolbarHeight / 2) + defaultOffset;
|
||||
|
||||
this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(newYCoordinate)}px, 0)`;
|
||||
/**
|
||||
* Move Toolbar to the Top coordinate of Block
|
||||
*/
|
||||
this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(currentNode.offsetTop)}px, 0)`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Open Toolbar with Plus Button
|
||||
*/
|
||||
open() {
|
||||
this.move();
|
||||
this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);
|
||||
/**
|
||||
* Wait Block rendering for correct height computing
|
||||
*/
|
||||
setTimeout(() => {
|
||||
this.move();
|
||||
this.nodes.wrapper.classList.add(Toolbar.CSS.toolbarOpened);
|
||||
}, 50);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -32,6 +32,12 @@
|
|||
}
|
||||
}
|
||||
|
||||
&__plus,
|
||||
.ce-toolbox {
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
|
||||
/**
|
||||
* Block actions Zone
|
||||
* -------------------------
|
||||
|
|
Loading…
Reference in a new issue