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:
George Berezhnoy 2018-09-20 16:46:40 +03:00 committed by GitHub
parent bdae8d3fad
commit cdf6d973c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 30 additions and 29 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -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": {

View file

@ -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
*/

View file

@ -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();
}
}

View file

@ -45,7 +45,7 @@
&__actions {
position: absolute;
right: 0;
top: 0;
top: 10px;
padding-right: 16px;
&-buttons {