mirror of
https://github.com/codex-team/editor.js
synced 2024-06-25 17:00:56 +02:00
37 lines
722 B
JavaScript
37 lines
722 B
JavaScript
/**
|
|
* Codex Editor Parser Module
|
|
*
|
|
* @author Codex Team
|
|
* @version 1.1
|
|
*/
|
|
|
|
var parser = (function(parser) {
|
|
|
|
/** inserting text */
|
|
parser.insertPastedContent = function(blockType, tag) {
|
|
|
|
codex.content.insertBlock({
|
|
type : blockType.type,
|
|
block : blockType.render({
|
|
text : tag.innerHTML
|
|
})
|
|
});
|
|
|
|
};
|
|
|
|
/**
|
|
* Check DOM node for display style: separated block or child-view
|
|
*/
|
|
parser.isFirstLevelBlock = function (node) {
|
|
|
|
return node.nodeType == cEditor.core.nodeTypes.TAG &&
|
|
node.classList.contains(cEditor.ui.className.BLOCK_CLASSNAME);
|
|
|
|
};
|
|
|
|
return parser;
|
|
|
|
})({});
|
|
|
|
module.exports = parser;
|