mirror of
https://github.com/codex-team/editor.js
synced 2024-06-29 02:40:23 +02:00
fix copying element on insert bug
This commit is contained in:
parent
30f5ba0cf7
commit
cb7f92e0a3
|
@ -1358,19 +1358,21 @@ cEditor.toolbar = {
|
||||||
appendCallback,
|
appendCallback,
|
||||||
newBlock;
|
newBlock;
|
||||||
|
|
||||||
|
/** Can replace? */
|
||||||
|
if (REPLACEBLE_TOOLS.indexOf(tool.type) != -1 && workingNode) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy plugin 'append' Element
|
* Copy plugin 'append' Element
|
||||||
*/
|
*/
|
||||||
newBlock = tool.append.cloneNode(true);
|
newBlock = tool.append.cloneNode(true);
|
||||||
|
|
||||||
/** Can replace? */
|
|
||||||
if (REPLACEBLE_TOOLS.indexOf(tool.type) != -1 && workingNode) {
|
|
||||||
|
|
||||||
/** Replace current block */
|
/** Replace current block */
|
||||||
cEditor.content.switchBlock(workingNode, newBlock, tool.type);
|
cEditor.content.switchBlock(workingNode, newBlock, tool.type);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
newBlock = tool.append;
|
||||||
|
|
||||||
/** Insert new Block from plugin */
|
/** Insert new Block from plugin */
|
||||||
cEditor.content.insertBlock(newBlock, tool.type);
|
cEditor.content.insertBlock(newBlock, tool.type);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue