mirror of
https://github.com/codex-team/editor.js
synced 2024-06-18 13:45:20 +02:00
Update toolbar move as not to overlap editor`s content (#455)
* Update toolbar move as not to overlap editor`s content * Bump version * Add top offset to toolbox actions * Calculate offset once
This commit is contained in:
parent
bdae8d3fad
commit
cdf6d973c1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "codex.editor",
|
||||
"version": "2.0.12",
|
||||
"version": "2.0.13",
|
||||
"description": "Codex Editor. Native JS, based on API and Open Source",
|
||||
"main": "build/codex-editor.js",
|
||||
"scripts": {
|
||||
|
|
|
@ -179,8 +179,10 @@ export default class Toolbar extends Module {
|
|||
* Set Toolbar Min Height as Block's height
|
||||
* Plus Button and Toolbox positioned at the center of the Toolbar
|
||||
*/
|
||||
this.nodes.content.style.minHeight = currentBlock.offsetHeight + 'px';
|
||||
const contentOffset = Math.floor(currentBlock.offsetHeight / 2);
|
||||
|
||||
this.nodes.plusButton.style.transform = `translate3d(0, calc(${contentOffset}px - 50%), 0)`;
|
||||
this.Editor.Toolbox.nodes.toolbox.style.transform = `translate3d(0, calc(${contentOffset}px - 50%), 0)`;
|
||||
/**
|
||||
* Move Toolbar to the Top coordinate of Block
|
||||
*/
|
||||
|
|
|
@ -296,9 +296,9 @@ export default class UI extends Module {
|
|||
event.stopPropagation();
|
||||
|
||||
/**
|
||||
* Close toolbar
|
||||
* Move and open toolbar
|
||||
*/
|
||||
this.Editor.Toolbar.close();
|
||||
this.Editor.Toolbar.open();
|
||||
|
||||
/**
|
||||
* Hide the Plus Button
|
||||
|
@ -318,7 +318,6 @@ export default class UI extends Module {
|
|||
isEmptyBlock = this.Editor.BlockManager.currentBlock.isEmpty;
|
||||
|
||||
if (isInitialBlock && isEmptyBlock) {
|
||||
this.Editor.Toolbar.open();
|
||||
this.Editor.Toolbar.plusButton.show();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
&__actions {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
top: 10px;
|
||||
padding-right: 16px;
|
||||
|
||||
&-buttons {
|
||||
|
|
Loading…
Reference in a new issue