mirror of
https://github.com/codex-team/editor.js
synced 2024-06-08 00:42:31 +02:00
Fix Toolbar's position bug in chrome (#448)
This commit is contained in:
parent
9ab437fe38
commit
205426470d
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,4 +1,3 @@
|
|||
import SelectionUtils from '../selection';
|
||||
/**
|
||||
*
|
||||
* «Toolbar» is the node that moves up/down over current block
|
||||
|
@ -167,25 +166,25 @@ export default class Toolbar extends Module {
|
|||
this.Editor.BlockSettings.close();
|
||||
}
|
||||
|
||||
let currentNode = this.Editor.BlockManager.currentBlock.holder;
|
||||
let currentBlock = this.Editor.BlockManager.currentBlock.holder;
|
||||
|
||||
/**
|
||||
* If no one Block selected as a Current
|
||||
*/
|
||||
if (!currentNode) {
|
||||
if (!currentBlock) {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Toolbar Min Height as Selection Height (usually similar with Block's height)
|
||||
* Set Toolbar Min Height as Block's height
|
||||
* Plus Button and Toolbox positioned at the center of the Toolbar
|
||||
*/
|
||||
this.nodes.content.style.minHeight = SelectionUtils.rect.height + 'px';
|
||||
this.nodes.content.style.minHeight = currentBlock.offsetHeight + 'px';
|
||||
|
||||
/**
|
||||
* Move Toolbar to the Top coordinate of Block
|
||||
*/
|
||||
this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(currentNode.offsetTop)}px, 0)`;
|
||||
this.nodes.wrapper.style.transform = `translate3D(0, ${Math.floor(currentBlock.offsetTop)}px, 0)`;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue