Remove placeholder when toolbar is opened

This commit is contained in:
George Berezhnoy 2017-08-30 03:40:16 +03:00
parent 276f797599
commit 880505a88c
5 changed files with 19 additions and 5 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

@ -12,6 +12,7 @@ module.exports = (function (toolbox) {
let editor = codex.editor;
toolbox.opened = false;
toolbox.openedOnBlock = null;
/** Shows toolbox */
toolbox.open = function () {
@ -23,6 +24,10 @@ module.exports = (function (toolbox) {
}
/** Add 'toolbar-opened' class for current block **/
toolbox.openedOnBlock = editor.content.currentNode;
toolbox.openedOnBlock.classList.add('toolbar-opened');
/** display toolbox */
editor.nodes.toolbox.classList.add('opened');
@ -37,7 +42,11 @@ module.exports = (function (toolbox) {
/** Closes toolbox */
toolbox.close = function () {
/** Makes toolbox disapear */
/** Remove 'toolbar-opened' class from current block **/
if (toolbox.openedOnBlock) toolbox.openedOnBlock.classList.remove('toolbar-opened');
toolbox.openedOnBlock = null;
/** Makes toolbox disappear */
editor.nodes.toolbox.classList.remove('opened');
/** Rotate plus button */

View file

@ -1,6 +1,6 @@
{
"name": "codex.editor",
"version": "1.7.0",
"version": "1.7.1",
"description": "Codex Editor. Native JS, based on API and Open Source",
"main": "index.js",
"scripts": {

View file

@ -6,6 +6,7 @@
padding: 0.7em 0 !important;
line-height: 1.7em;
}
.ce-paragraph:empty::before,
.ce-paragraph p:empty::before{
content : attr(data-placeholder);
@ -17,6 +18,10 @@
opacity: .1;
}
.toolbar-opened .ce-paragraph::before {
content: '';
}
.ce-paragraph p {
margin: 1.2em 0;