mirror of
https://github.com/codex-team/editor.js
synced 2024-06-10 09:52:36 +02:00
Remove placeholder when toolbar is opened
This commit is contained in:
parent
276f797599
commit
880505a88c
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -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 */
|
||||
|
|
|
@ -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": {
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue