mirror of
https://github.com/codex-team/editor.js
synced 2024-06-28 02:10:31 +02:00
parent
0ce6987c1d
commit
b582654c13
|
@ -733,7 +733,16 @@ cEditor.content = {
|
|||
|
||||
},
|
||||
|
||||
insertBlock : function(newBlock, blockType) {
|
||||
|
||||
var workingNode = cEditor.content.currentNode;
|
||||
|
||||
el.classList.add(cEditor.ui.BLOCK_CLASSNAME);
|
||||
newBlock.dataset.type = blockType;
|
||||
|
||||
cEditor.core.insertAfter(workingNode, newBlock);
|
||||
|
||||
},
|
||||
/**
|
||||
* @deprecated with replaceBlock()
|
||||
*/
|
||||
|
@ -1139,7 +1148,12 @@ cEditor.toolbar = {
|
|||
* @todo
|
||||
* use insertBlock or replaceBlock instead of switchBlock
|
||||
*/
|
||||
cEditor.content.switchBlock(workingNode, newTag);
|
||||
// cEditor.content.switchBlock(workingNode, newTag);
|
||||
|
||||
var tools = cEditor.tools[cEditor.toolbar.current];
|
||||
|
||||
/** Insert new Block from plugin */
|
||||
cEditor.content.insertBlock(tools.append, tools.type);
|
||||
|
||||
/** Fire tool append callback */
|
||||
appendCallback = cEditor.tools[cEditor.toolbar.current].appendCallback;
|
||||
|
@ -1471,7 +1485,7 @@ cEditor.tools = {
|
|||
|
||||
},
|
||||
|
||||
quote : {
|
||||
/*quote : {
|
||||
|
||||
type : 'quote',
|
||||
iconClassname : 'ce-icon-quote',
|
||||
|
@ -1481,7 +1495,7 @@ cEditor.tools = {
|
|||
},
|
||||
settings : null,
|
||||
|
||||
},
|
||||
},*/
|
||||
|
||||
code : {
|
||||
|
||||
|
@ -1675,7 +1689,13 @@ var headerTool = {
|
|||
*/
|
||||
makeBlockToAppend : function () {
|
||||
|
||||
return document.createElement('H2');
|
||||
var el = document.createElement('H2');
|
||||
|
||||
el.contentEditable = 'true';
|
||||
|
||||
cEditor.ui.addBlockHandlers(el);
|
||||
|
||||
return el;
|
||||
|
||||
},
|
||||
|
||||
|
@ -1764,6 +1784,9 @@ var headerTool = {
|
|||
|
||||
cEditor.content.replaceBlock(old_header, new_header, 'header');
|
||||
|
||||
/** Add listeners for Arrow keys*/
|
||||
cEditor.ui.addBlockHandlers(new_header);
|
||||
|
||||
/** Close settings after replacing */
|
||||
cEditor.toolbar.settings.close();
|
||||
|
||||
|
|
Loading…
Reference in a new issue