2017-01-10 19:22:40 +01:00
|
|
|
/**
|
|
|
|
* Codex Editor Parser Module
|
|
|
|
*
|
|
|
|
* @author Codex Team
|
|
|
|
* @version 1.1
|
|
|
|
*/
|
2016-12-07 19:25:31 +01:00
|
|
|
|
2017-01-10 19:22:40 +01:00
|
|
|
var parser = (function(parser) {
|
2016-12-07 19:25:31 +01:00
|
|
|
|
|
|
|
/** inserting text */
|
2017-01-10 19:22:40 +01:00
|
|
|
parser.insertPastedContent = function(blockType, tag) {
|
2016-12-07 19:25:31 +01:00
|
|
|
|
2017-01-10 19:22:40 +01:00
|
|
|
codex.content.insertBlock({
|
|
|
|
type : blockType.type,
|
|
|
|
block : blockType.render({
|
|
|
|
text : tag.innerHTML
|
2016-12-07 19:25:31 +01:00
|
|
|
})
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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;
|